\documentclass[11pt,a4paper]{report}
%\usepackage{ctex}
\usepackage[centerlast]{caption2}
\usepackage{fancybox}
\usepackage{amsfonts}
\usepackage[toc,page,title,titletoc,header]{appendix}
\usepackage{color}
\usepackage{xcolor}
\usepackage{titlesec}
\usepackage{ifthen,calc,lastpage,listings}
\usepackage{amsthm}
\usepackage{latexsym}
\usepackage{amsmath}        % AMSLaTeX
\usepackage{amssymb}        % AMSLaTeX sym-bols
\usepackage{indentfirst}    % indent first line of each section
\usepackage{longtable}      % table that occupies multiple pages
\usepackage{subfigure}      %
\usepackage{slashbox}       %@@表格头画斜线
\usepackage{graphicx}       %@@图象
\usepackage{graphics}       %@@图象
\usepackage{flafter}
\usepackage{pifont}
\usepackage{picinpar}

\usepackage{xeCJK}

\graphicspath{{截图/}}

\renewcommand\thesection{\arabic{section}~}
\renewcommand\thesubsection{\arabic{section}.\arabic{subsection}~}
\titleformat{\paragraph}[block]{\normalsize\bfseries}{\thesection}{0.3em}{}

\setCJKfamilyfont{akai}{Adobe Kaiti Std}
\newcommand{\akai}[1]{\CJKfamily{akai} #1}
\setCJKfamilyfont{ahei}{Adobe Heiti Std}
\newcommand{\ahei}[1]{\CJKfamily{ahei} #1}
\setCJKfamilyfont{asong}{Adobe Song Std}
\newcommand{\asong}[1]{\CJKfamily{asong} #1}
\setCJKfamilyfont{afsong}{Adobe Fangsong Std}
\newcommand{\afsong}[1]{\CJKfamily{asong} #1}
\setCJKfamilyfont{hei}{SimHei}
\newcommand{\hei}[1]{\CJKfamily{hei} #1}
\setCJKfamilyfont{cyun}{STCaiyun}
\newcommand{\cyun}[1]{\CJKfamily{cyun} #1}
\setCJKfamilyfont{song}{SimSun}
\newcommand{\song}[1]{\CJKfamily{song} #1}
\setCJKfamilyfont{yyuan}{YouYuan}
\newcommand{\yyuan}[1]{\CJKfamily{yyuan} #1}
\setCJKfamilyfont{kai}{KaiTi_GB2312}
\newcommand{\kai}[1]{\CJKfamily{kai} #1}
\setCJKfamilyfont{dkuan}{WenQuanYi Micro Hei Mono}
\newcommand{\dkuan}[1]{\CJKfamily{dkuan} #1}
\setCJKfamilyfont{fangsong}{FangSong_GB2312}
\newcommand{\fsong}[1]{\CJKfamily{fangsong} #1}
\setCJKfamilyfont{xkai}{STXingkai}
\newcommand{\xkai}[1]{\CJKfamily{xkai} #1}
\setCJKfamilyfont{loli}{DFGirl:style=Regular}
\newcommand{\loli}[1]{\CJKfamily{loli} #1}
\setCJKfamilyfont{bsong}{STZhongsong:style=Regular}
\newcommand{\bsong}[1]{\CJKfamily{bsong} #1}

\newcommand{\chuhao}{\fontsize{42pt}{\baselineskip}\selectfont}     % 字号设置
\newcommand{\xiaochuhao}{\fontsize{36pt}{\baselineskip}\selectfont} % 字号设置
\newcommand{\yichu}{\fontsize{32pt}{\baselineskip}\selectfont}      % 字号设置
\newcommand{\yihao}{\fontsize{28pt}{\baselineskip}\selectfont}      % 字号设置
\newcommand{\erhao}{\fontsize{21pt}{\baselineskip}\selectfont}      % 字号设置
\newcommand{\xiaoerhao}{\fontsize{18pt}{\baselineskip}\selectfont}  % 字号设置
\newcommand{\sanhao}{\fontsize{15.75pt}{\baselineskip}\selectfont}  % 字号设置
\newcommand{\sihao}{\fontsize{14pt}{\baselineskip}\selectfont}      % 字号设置
\newcommand{\xiaosihao}{\fontsize{12pt}{\baselineskip}\selectfont}  % 字号设置
\newcommand{\wuhao}{\fontsize{10.5pt}{\baselineskip}\selectfont}    % 字号设置
\newcommand{\xiaowuhao}{\fontsize{9pt}{\baselineskip}\selectfont}   % 字号设置
\newcommand{\liuhao}{\fontsize{7.875pt}{\baselineskip}\selectfont}  % 字号设置
\newcommand{\qihao}{\fontsize{5.25pt}{\baselineskip}\selectfont}    % 字号设置

\setmainfont{Minion Pro}
\setsansfont{Myriad Pro}
%\setmonofont{Lucida Sans Typewriter}
\setCJKmainfont[BoldFont=SimHei,ItalicFont=KaiTi_GB2312]{SimSun}

\DeclareSymbolFont{operators}{OT1}{cmtt}{m}{n}
\DeclareMathSizes{10}{10}{7}{5}
\DeclareSymbolFont{symbols}{OMS}{cmex}{m}{n}
\mathversion{bold}
\DeclareMathSizes{13.82}{14.4}{10}{7}

\usepackage{array}
\newcommand{\PreserveBackslash}[1]{\let\temp=\\#1\let\\=\temp}
\newcolumntype{C}[1]{>{\PreserveBackslash\centering}p{#1}}
\newcolumntype{R}[1]{>{\PreserveBackslash\raggedleft}p{#1}}
\newcolumntype{L}[1]{>{\PreserveBackslash\raggedright}p{#1}}

\usepackage{color}
\usepackage{xcolor}
\definecolor{grey}{rgb}{0.3,0.3,0.3}
\definecolor{darkgreen}{rgb}{0,0.3,0}
\definecolor{darkblue}{rgb}{0,0,0.3}
\definecolor{grey}{rgb}{0.95,0.95,0.95}
\definecolor{darkgreen}{rgb}{0.0,0.5078,0.0}
\definecolor{purple}{rgb}{1,0.12,0.12}
\definecolor{brown}{rgb}{0.545,0.271,0.075}

\renewcommand{\sfdefault}{phv}
\lstset{language=C++}
\lstset{%
         basicstyle=\scriptsize\ttfamily,% Standardschrift
         numbers=left,%               % Ort der Zeilennummern
         numberstyle=\tiny,% 
         %stepnumber=2,
         numbersep=5pt,%
showstringspaces=false,% Leerzeichen in Strings anzeigen ?  
commentstyle=\color{darkgreen}\itshape,%
keywordstyle=\color{blue}\bfseries,
stringstyle=\color{red},%
rulesepcolor=\color{red}\bfseries,%
directivestyle=\color{brown}\bfseries,%
%backgroundcolor=\color{lightgray},%背景
caption=\lstname,
         extendedchars=true,%         %
         breaklines=true,%            % Zeilen werden Umgebrochen
         columns=flexible,%
         mathescape=fause,%  
%         frame=b,%去掉下划线      
         showspaces=false,% 空格不可见
         tabsize=4,           % \t的长度
         showtabs=false             %\t 不可见
}
\lstset{framexleftmargin=17pt,framexrightmargin=5pt,framextopmargin=0pt,framexbottommargin=4pt}
\lstset{xleftmargin=17pt,xrightmargin=5pt}
\renewcommand{\lstlistingname}{C语言源码} %%%标题        
\lstloadlanguages{C,C++,Java,Matlab,Mathematica,[ANSI]C}

\addtolength{\textwidth}{1in}
\addtolength{\oddsidemargin}{-.5in}
\addtolength{\textheight}{1in}
\addtolength{\topmargin}{-.5in}

%\usepackage{fancyhdr}
%\pagestyle{fancy} \lhead{}
%\chead{实验报告} \rhead{} \lfoot{}
%\cfoot{\thepage}%%% team control number as package option    @@ 修改%队号
%\rfoot{}
%\renewcommand{\headrulewidth}{0.7pt}
\renewcommand{\headheight}{13.6pt}
\renewcommand{\figurename}{\footnotesize{\textbf{截图}}}

\usepackage{graphicx}
\begin{document}
\lstinputlisting[language=C++]{banji1.c}
\lstinputlisting[language=C++]{qijianji1.c}
\lstinputlisting[language=C++]{banji2.c}
\lstinputlisting[language=C++]{qijianji2.c}
\end{document}